import promise from 'es6-promise'
promise.polyfill()
import "core-js/stable";
import "regenerator-runtime/runtime";
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './routerConfig'
import "@/assets/css/global.css"
import './plugins/element.js'
import 'element-ui/lib/theme-chalk/index.css'
import axios from '@/utils/axiosConfig.js'
// import CookieJs from '@/utils/Cookie.js'
import mconfig from  "@/utils/config.js"
Vue.prototype.$http = axios
Vue.prototype.mconfig=mconfig
Vue.config.productionTip = false

new Vue({
  router,
  store,
  created() {
    // 通过sessionStorage进行状态保存
    sessionStorage.getItem('originStore') || sessionStorage.setItem('originStore', JSON.stringify(this.$store.state))
    sessionStorage.getItem('store') && this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem('store'))));
    window.addEventListener('beforeunload', () => {
      sessionStorage.setItem('store', JSON.stringify(this.$store.state))
    });
  },
  mounted() {
    // CookieJs.generateCookie()
  },
  render: function (h) {
    return h(App)
  }
}).$mount('#app')